//
// Created by 子夜求知 on 2022/9/17.
//

#ifndef TREEPROJECT_STRING_H
#define TREEPROJECT_STRING_H
#include "string.h"
/**
 *
 * @param s：被截取字符串
 * @param start：起始位置
 * @param count：截取长度
 * @param t：截取之后的字符串
 */
void substring(char s[ ], long start, long count, char t[ ])
{
    long i,j,length=strlen(s);
    if (start<1 || start>length)
        printf("The copy position is wrong");
    else if (start+count-1>length)
        printf("Too characters to be copied");
    else{
        for(i=start-1,j=0; i<start+count-1;i++,j++)
            t[j]=s[i];
        t[j]= '\0';
    }
}

#endif //TREEPROJECT_STRING_H
